<template>
  <div>
    <el-menu
      :default-active="activeIndex"
      class="el-menu-demo"
      mode="horizontal"
      @select="handleSelect"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b"
    >
      <el-menu-item index="1" @click="goHome">首页</el-menu-item>
      <el-menu-item index="2">详情</el-menu-item>
    </el-menu>
  </div>
</template>

<script>
export default {
  name: "navbar",
  data() {
    return {
      activeIndex: "2",
      userInfo: {
        id: "",
      },
    };
  },
  created() {
    this.userInfo = this.$store.getters.getUser;
  },
  methods: {
    handleSelect(key, keyPath) {
      this.activeIndex = key;
    },
    goHome() {
      this.$router.push('/home')
    },

  },
};
</script>

<style lang="scss" scoped>
.el-menu {
  box-sizing: border-box;
  padding: 0 200px;
  position: relative;
}
</style>